import React from "react";
import { useNavigate, useSearchParams } from "react-router-dom";

export default function Login() {
  const navigate = useNavigate();
  const [searchParams, fn] = useSearchParams();
  const redirect = searchParams.get("redirect");
  console.log("redirect", redirect);

  function handleClick() {
    console.log(fn);
    fn("?redirect=/help");
  }

  return (
    <div>
      <h1>Login</h1>
      <button onClick={handleClick}>点我，就登录成功</button>
    </div>
  );
}
